<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateCategoriesTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('categories', function(Blueprint $table)
		{
			$table->integer('id', true);
			$table->string('name', 160)->comment('商品分类的名称');
			$table->string('const', 160)->nullable()->comment('分类名常量，英文字符');
			$table->integer('parent_id')->default(0)->comment('父级的id值');
			$table->integer('level')->nullable()->default(0)->comment('分类的级别 0：顶级分类');
			$table->integer('priority')->unsigned()->default(0)->comment('排序优先级，越大越前');
			$table->integer('has_asset')->default(0)->comment('是否关联素材, 0：无关联 1：关联');
			$table->string('icon_active')->nullable()->comment('高亮icon、点击时的图标');
			$table->string('icon')->nullable()->comment('普通icon，未点击时的图标');
			$table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('categories');
	}

}
